/*
初始化指定大小vector
std::vector<int> a(size, 0);或者
std::vector<int> a;
a.resize(size);
*/

class Solution {
public:
    int climbStairs(int n) {
        std::vector<int> dp(n+1, 0);
        if(n == 1 || n == 2)
        {
            return n;
        }
        // dp.clear();
        dp[1] = 1;
        dp[2] = 2;
        for(int i = 3; i < n + 1; i++)
        {
            dp[i] = dp[i - 1] + dp[i - 2];
        }
        return dp[n];

    }
};